<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of project
 *
 * @author truongkx
 */
class home extends SM_Controller{
    //put your code here
    function __construct() {
        parent::__construct('system','','Id');
    }
    protected function beforecommit(){
        if(isset($_REQUEST['Params']['Value']))$_POST['Params']['Value'] = $_REQUEST['Params']['Value'];
    } 
    
    
    function index(){
		$this->assigns->items=$this->backend_model->onGets();
        echo $c=$this->load->view('cms/sm/viewport',$this->assigns,true);
    }
    
    function viewport($type=''){
        $this->assigns->type=$type;
        $this->backend_model->db->where('Type',$type);
        $this->assigns->items=$this->backend_model->onGets();
        echo $c=$this->load->view('cms/sm/viewport',$this->assigns,true);
    }

    function editpanel(){
        $Id=(int)$this->input->post('Id');
        if($Id>0){
            $this->assigns->item=$this->backend_model->onGet($Id);
        }
        $c=$this->load->view('cms/cp/03_project/editpanel',$this->assigns,true);
        $R["result"] = 1;
        $R["message"]='SUCCESS !';
        $R["htmlreponse"]=$c;
        $this->output->set_header('Content-type: application/json');
        $this->output->set_output(json_encode($R));
    }
}

?>
